<template>
	<div>
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.id">
				<router-link :to="'/home/newsinfo/' + item.id">
					<img class="mui-media-object mui-pull-left" src="" />
					<div class="mui-media-body">
						<h4>{{ item.name }}</h4>
						<p class="mui-ellipsis">
							<span>发表时间：{{ item.ctime | dateFormat('YYYY-MM-DD') }}</span>
							<span>点击:11次{{ item.click }}</span>
						</p>
					</div>
				</router-link>
			</li>
		</ul>
	</div>
</template>
<script>
export default {
	data() {
		return {
			newslist: [],
		}
	},
	created() {
		this.getNewsList()
	},
	methods: {
		getNewsList() {
			this.$http.get('api/getprodlist').then(
				function(res) {
					this.newslist = res.body.message
					console.log(res)
					// http://jsonplaceholder.typicode.com/users this.newslist=res.body
				},
				function(res) {
					console.log(res.status + '失败')
				}
			)
		},
	},
}
</script>
<style lang="scss">
.mui-table-view li span {
	color: skyblue;
	font-size: 12px;
}
.mui-ellipsis {
	display: flex;
	justify-content: space-between;
}
</style>
